<%Const respagecode="user_edit"%><% 'UTF-8%>
<%''加载通用函数和数据库连接%>
<!--#include file="../Include/Start.asp"-->
<%'检查是否登录%>
<!--#include file="../Include/checklogin.asp"-->


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 	<!--meta信息-->
	<!--#include file="../Include/meta.asp"-->
	<!--end meta-->
	

	<link href="../css/css-1.05.css" rel="stylesheet" type="text/css" />
	<link href="../css/console-1.03.css" rel="stylesheet" type="text/css" />
	<link href="../css/calendar.css" rel="stylesheet" type="text/css" />
	<link href="../css/console_home-1.06.css" rel="stylesheet" type="text/css" />
	
	<script type="text/javascript" src="../js/jquery-1.3.2.js"></script>
	<script type="text/javascript" src="../js/jquery.extend-1.06.js"></script>
	<script type="text/javascript" src="../js/common_1.01.js"></script>
	<script type="text/javascript" src="../js/console_user.js"></script>
	<script type="text/javascript" src="../js/calendar/WdatePicker.js"></script>
	<script type="text/javascript" src="../js/menu.js"></script>
	<script type="text/javascript" src="../js/TrimPathTemplate.js"></script>
</head>

<body>
<div class="wrapper">

	<!--header页头信息-->
	<!--#include file="../Include/header.asp"-->
	<!--end header页头信息-->


	<!--navigation菜单信息-->
	<!--#include file="../Include/navigation.asp"-->
	<script type="text/javascript">$("#navigation").menu('point');</script>
	<!--end navigation菜单信息-->

<!--begin container-->
<div class="container" id="container">
 
	<!--
	<div class="c_left">
		<h2>权限管理</h2>
		<ul>
			<li class="on"><h3><a href="/admin/users.asp">用户管理</a></h3></li>
			<li><h3><a href="/admin/roles.asp">角色</a></h3></li>
			<li><h3><a href="/admin/resources.asp">资源</a></h3></li>
		</ul>
	</div>-->
	<div class="c_left">
		<!--begin left_menu 左侧菜单信息-->
		<!--#include file="../Include/left_menu.asp"-->
		<!--end left_menu 左侧菜单信息-->	
	</div>	 
	
	<div class="c_right">
		<div class="c_r_head">
			<ul class="head_tab">
				<li><h4><a href="users.asp##div_tab_list">用户管理</a></h4></li>
				<li class="on"><h4><a href="#">修改</a></h4></li>
			</ul>
		</div>	<%
	 	''定义查询字段变量
 	dim id,UserID, GroupID, ClientID, UserType, UserName, Email, Mobile, TrueName ,NickName ,UserTypeName
	
''用户信息
		UserID=ReplaceBadChar(Trim(request("UserID")))
		if(""=UserID) then response.redirect "/users.asp" ''如果id并没有传来跳转回原处
			''Dim rsObj,strSql
			set rsObj=Server.CreateObject("ADODB.Recordset")
			strSql = "Select  *  "
		strSql=strSql & " , UserTypeName =   (CASE   WHEN 1 = UserType THEN '受理机构用户' WHEN 0 = UserType THEN '管理员'  WHEN 2 = UserType THEN '企业用户'  END ) "
		strSql=strSql & "  from PE_User where UserID='"&UserID&"' "
			''Response.Write strSql&"-----"
			rsObj.Open strSql, Conn, 1, 3
			If rsObj.BOF And rsObj.EOF Then 
				 response.redirect "/users.asp" ''如果id并没有传来跳转回原处
			end if	 
			UserID=ReplaceBadChar(Trim(rsObj("UserID")))
			UserType=ReplaceBadChar(Trim(rsObj("UserType")))
			UserName=ReplaceBadChar(Trim(rsObj("UserName")))
			TrueName=ReplaceBadChar(Trim(rsObj("TrueName")))
			NickName=ReplaceBadChar(Trim(rsObj("NickName")))
			UserTypeName=ReplaceBadChar(Trim(rsObj("UserTypeName")))
			''关闭链接
			rsObj.close		

	%>	
		
		<div class="c_r_body" id="div_tab_edit">
			<form action="users_do.asp" method="post" id="form_edit">
				<input id="UserID" name="UserID" type="hidden" value="<%=UserID%>" />
				<input id="UserName" name="UserName" type="hidden" value="<%=UserName%>" />
			<div align="center" style="height:25px">
			请输入用户的详细信息
			</div>
				<table width="100%" border="0" cellpadding="2" cellspacing="4" style="margin:auto">
		 
					<tr>
						<td align="right">用户代码:</td>
						<td><%=UserID%></td>
					</tr>
					<tr>
						<td align="right">用户类型:</td>
						<td>
							<select name="UserType" id="UserType"  style="width: 88px;">
								<option <%if "2"=UserType then Response.Write " selected "%> value="2" label="企业用户">企业用户</option>
								<option <%if "1"=UserType then Response.Write " selected "%> value="1" label="受理机构用户">受理机构用户</option>
								<option <%if "0"=UserType then Response.Write " selected "%> value="0" label="管理员">管理员</option>
							</select>
						</td>
					</tr>
					<tr>
						<td align="right">用户名称:</td>
						<td><%=UserName%></td>
					</tr>
					<tr>
						<td align="right">昵称:</td>
						<td><input type="text" name="NickName" id="NickName"  value="<%=NickName%>" class="text" style="width:100px" maxlength="50" /></td>
					</tr>
					<tr>
						<td align="right">真实名:</td>
						<td><input type="text" name="TrueName" id="TrueName"  value="<%=TrueName%>" class="text" style="width:90px" maxlength="50" /></td>
					</tr>
					<tr>
						<td align="right">[该用户的角色]:</td>
						<td></td>
					</tr>
 				
				<table width="100%" border="0" cellpadding="2" cellspacing="0" class="list">
					<colgroup>
						<col width="30"/>
						<col/>
						<col/>
					</colgroup>
					<thead>
						 <tr>
							<th align="center"><input type="checkbox" id="checkboxAllt"  name="checkboxAllt" onclick="checkboxAll('user_roles',this);"/></th>
							<th>角色代码</th>
							<th>角色名称</th>
						</tr>
					</thead>
					<tr class="line">
						<td colspan="3"><div></div></td>
					</tr>
					<tbody>					
		<%
			''查找改用户的角色		
			strSql = " SELECT T_ROLE.id as ROLE_id, T_ROLE.role_name, nn.role_id AS user_role_i, nn.user_id  "
			strSql=strSql & "  FROM T_ROLE LEFT OUTER JOIN  "
			strSql=strSql & "  (SELECT mm.* FROM T_USER_ROLE mm WHERE mm.user_id = '"&UserID&"') nn ON T_ROLE.id = nn.role_id "
			''Response.Write strSql&"-----"

			rsObj.Open strSql, Conn, 1, 3			 
			do while not rsObj.eof
				%>
					<%dim tr_class%>
					<%if "bgblue"=tr_class then tr_class ="" else tr_class ="bgblue" end if%>
				  <tr class="<%=tr_class%>" onmouseover="$(this).addClass('on')" onmouseout="$(this).removeClass('on')">
					<td align="right"><input type="checkbox" name="user_roles" id="user_roles" 
						<%if Not IsNull(rsObj("user_role_i")) then Response.Write " checked "%> 
						value="<%=Trim(rsObj("ROLE_id"))%>"/></td>
					<td><%=Trim(rsObj("ROLE_id"))%></td>
					<td><%=Trim(rsObj("role_name"))%></td>
				</tr>

			<%
				rsObj.movenext
			loop 
			''关闭链接
			rsObj.close		


		%>
					</tbody>
					<tr class="line">
						<td colspan="3">
						<div></div>
						</td>
					</tr>
				</table>			
					
					<tr>
						<td align="right"> </td>
						<td><input name="" type="submit" value="添加" />&nbsp;<label id="result"></label></td>
					</tr>
				</table>
			</form>
		</div>
	</div>

	<script type="text/javascript">
		/*选中该tab页 需要tab页上有ID*/
		$("#Permissions").attr("className","on")
		
		initPage_edit();	
		//$('#scform').submit();
</script>
	
 
 
</div>



	
	
</div>
<!--footer页脚信息-->
<!--#include file="../Include/footer.asp"-->
<!--end footer页脚信息-->
</div>
</body>
</html>

<%
			Set rsObj = Nothing 

 '释放数据库链接
	call CloseConn	
	%>	
